package com.example.mygame.controller;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;

import com.example.mygame.R;
import com.example.mygame.service.MyFriendAdopter;
import com.example.mygame.pojo.Friend;
import com.example.mygame.service.SqliteUtils;

import java.util.List;

public class ShowFriend extends AppCompatActivity {

    private SqliteUtils sqliteUtils;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_friend);

        sqliteUtils = new SqliteUtils(this);

        Intent getDataIntent = getIntent();

        String userName = getDataIntent.getStringExtra("userName");

        List<Friend> friendList = sqliteUtils.showFriend(userName,"1");

        ListView listView = (ListView) findViewById(R.id.list);

        listView.setAdapter(new MyFriendAdopter(friendList,this));


    }
}